﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ProjectOpenCourseware.aspx.cs" Inherits="Theme_3_ProjectOpenCourseware" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>打开课件</title>
    <link href="../../css/Comment.css" type="text/css" rel="stylesheet" />
    <script src="../../js/jquery-1.2.js" language="javascript" type="text/javascript"></script>
    <script language="javascript" for="window" event="onbeforeunload">        
        
        WriteLog();        
        
       function WriteLog() 
       {          
            var v = "<%=_isUpdateCourse %>"
            if(v=="1")
            {   
                window.location="<%=_url %>";
            }
       }
       
      //  setCookie("showcomment","1");
    </script>
    
    <script  language="javascript" type="text/javascript">
        function findFrame(win)
        {
            var frmname;
            frmname=win.name;
        //	alert(frmname!="LeftupFrame");
            if (frmname!="LeftupFrame")
            {
                if(win.frames.length>0)
                {
                   for (i=0;i<win.frames.length;i++)
                   {
                       if(win.frames[i]!=null)
                       {
                          if(win.frames[i].name=="LeftupFrame")
                          {
                             win=win.frames[i];
                             return win;
                          }
                          else
                          {
                             if (win.frames[i].frames.length>0)
                                 return findFrame(win.frames[i]);  
                          }
                       }
                   }
                }
            }
            else
            {
               return win;           
            }
        }
         // 去掉字符串的头空格（左空格）
        function LTrim(str){ 
            var i;
            for(i=0;i<str.length; i++) {
                if(str.charAt(i)!=" ") break;
            }
            str = str.substring(i,str.length);
            return str;
        }
        
        // 去掉字符串的尾空格（右空格）
        function RTrim(str){
            var i;
            for(i=str.length-1;i>=0;i--){
                if(str.charAt(i)!=" ") break;
            }
            str = str.substring(0,i+1);
            return str;
        }
        
        // 去掉字符串的头尾空格（左右空格）
        function Trim(str){
            return LTrim(RTrim(str));
        }
        
        //获取指定名称的cookie的值
        function getCookie2(objName){           
            var arrStr = document.cookie.split(";");
            for(var i = 0;i < arrStr.length;i ++)
            {    
                var temp = arrStr[i].split("=");                
                if(Trim(temp[0]) == Trim(objName)) 
                    return unescape(temp[1]);   
            }
        }
        function   setCookie(name,value) {     
            var   Days   =   30;               //此   cookie   将被保存   30   天     
            var   exp     =   new   Date();         //new   Date( "December   31,   9998 ");     
            exp.setTime(exp.getTime()   +   Days*24*60*60*1000);     
            document.cookie   =   name   +   "= "+   escape(value)   + ";expires= "+   exp.toGMTString(); 
        }
        
//        function ShowComment()
//        {
//                
//            //var vs = window.ffMain.LeftupFrame.MediaPlayer.Controls.currentPosition;
//            var vObj=findFrame(window.parent.MainFrame);
//                vObj.MediaPlayer.Controls.currentPosition;
//                
//            var name = "playtime"+vs;                        
//        }
            //_ShowCommentP = "1";
            setCookie("showcomment","0");
             var v1 = "<%=_ShowCommentP %>"
             if(v1 == "1")
             {  
                setCookie("showcomment","1");
             }
    </script>
</head>
<body topmargin="0">
    <form id="form1" runat="server">
     <asp:Panel ID="pl_PowerCreaotr" runat="server" Width="100%" Visible="false">
            <script language="javascript">        
            var vpowercreator = "<%=_vPowerCreator %>"
            if(vpowercreator == "1")
            {
                var str = "";
	            var height=window.screen.availHeight-117;	
            //	var heig1 = window.screen.availHeight+30;//IE窗口的高度
	            str += "<table width='100%' height='"+window.screen.availHeight+"' border='0' cellpadding='0' cellspacing='0' topmargin='0'><tr><td height="+height+" valign='top'>";
	            str+="<iframe id='MainFrame' name='MainFrame' frameborder='0' scrolling='no' width='100%'  height='100%'  src='<%=_fileUrl %>'></iframe></td></tr></table>";
	            document.write(str);
            }
            </script>
        </asp:Panel>
        <asp:Panel ID="pl_Video" runat="server" Width="100%" Visible="false">
            <object align="right" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="MediaPlayer"
                width="100%" height="100%" type="application/x-oleobject" standby="Loading Microsoft? Windows? Media Player components...">
                <param name="URL" value="<%=_fileUrl%>">
                <param name="rate" value="1">
                <param name="balance" value="0">
                <param name="currentPosition" value="0">
                <param name="defaultFrame">
                <param name="playCount" value="1">
                <param name="autoStart" value="-1">
                <param name="currentMarker" value="0">
                <param name="invokeURLs" value="-1">
                <param name="baseURL">
                <param name="volume" value="100">
                <param name="mute" value="0">
                <param name="uiMode" value="full">
                <param name="stretchToFit" value="-1">
                <param name="windowlessVideo" value="0">
                <param name="enabled" value="-1">
                <param name="enableContextMenu" value="-1">
                <param name="fullScreen" value="0">
                <param name="SAMIStyle">
                <param name="SAMILang">
                <param name="SAMIFilename">
                <param name="captioningID">
            </object>
        </asp:Panel>
        <asp:Panel ID="pl_Download" runat="server" Width="100%" Visible="false">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tree-titbg_right">
                <tr>
                    <td class="tree-titbg_left">
                        <asp:Label ID="lbl_ResourceName" runat="server" Text=""></asp:Label></td>
                </tr>
            </table>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <img src="../../css/1/images/download.jpg" /></td>
                    <td>
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                            <td>创建日期</td>
                            <td>
                                <asp:Label ID="lbl_CreatedTime" runat="server" Text=""></asp:Label></td>
                            </tr>
                            <tr>
                            <td>文件下载次数</td>
                            <td>
                                <asp:Label ID="lbl_DownloadCount" runat="server" Text=""></asp:Label></td>
                            </tr>
                            <tr>
                            <td style="height: 17px">
                                最后下载时间</td>
                            <td style="height: 17px">
                                <asp:Label ID="lbl_LastTime" runat="server" Text=""></asp:Label></td>
                            </tr>
                            <tr>
                                <td >
                                    <asp:HyperLink ID="hyplnk_FileUrl" runat="server">立即下载</asp:HyperLink></td>
                                    <td>
                                        <asp:HyperLink ID="hyplnk_ImgFileurl" Visible="False" runat="server" ImageUrl="~/css/1/images/download_icon.gif"></asp:HyperLink>
                                        <asp:ImageButton ID="imgbtn_FileDown" runat="server" ImageUrl="~/css/1/images/download_icon.gif" OnClick="imgbtn_FileDown_Click" />
                                        <asp:Label ID="lab_err" runat="server" Text="" ForeColor="Red"></asp:Label></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <table style="width:100%;" border="0" cellpadding="0" cellspacing="0" class="mainList">
                <tr>
                    <th>描述</th>
                </tr>
                <tr>
                    <td style="height: 19px">
                        <asp:Literal ID="li_Description" runat="server"></asp:Literal></td>
                </tr>
            </table>
        </asp:Panel>
        <!--评论-->
       <asp:Panel ID="pl_coursewarecomment" runat="server" Width="100%" Visible="true">
        <table width="100%" align="Center">
            <tr>
                <td>
                    <asp:Repeater ID="rptCommentLevel" runat="server">
                        <HeaderTemplate>
                            <table width="100%" class="default_table">
                                <tr>
                                    <td>
                                        <span>评价 </span>
                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td>
                                        <span>总评分:</span></td>
                                    <td>
                                        <asp:Label ID="lblCount" runat="server" ></asp:Label></span></td>
                                </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <span><%#DataBinder.Eval(Container.DataItem, "KeyName")%></span></td>
                                <td><span><%#DataBinder.Eval(Container.DataItem, "Count")%></span></td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            </table>
                        </FooterTemplate>
                    </asp:Repeater>
                </td>
                <td valign="Top">
                    <table width="100%" class="default_table_comment">
                        <tr>
                            <td>
                                <input type="button" value="写评论" id="btn" onclick="AddComment();" />
                                <input id="btnShowComment" type="button" value="自动弹出评论" onclick="SetShowComment();" />
                                <input id="btnCancleShowComment" type="button" value="取消弹出评论" onclick="SetNoShowComment();" /></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <br />
        <table width="98%" align="Center" class="default_table_comment">
            <tr>
                <td valign="top">
                    <h3>
                        课件点评 <span>(<a href="###">全部<asp:Label ID="lblCommentCount"
                            runat="server"></asp:Label><span></span>条</a>)</span></h3>
                </td>
                <td>
                    <a class="more" onclick="AddComment();" href="###">我来说两句&gt;&gt;</a>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Repeater ID="rptCommentList" runat="server" OnItemCommand="rptCommentList_ItemCommand" >
                        <HeaderTemplate>
                            <table width="100%" class="default_table_comment">
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <a href="#">
                                        <%#DataBinder.Eval(Container.DataItem, "CreatedUserName")%>
                                    </a>
                                </td>
                                <td>
                                    <span class="timecss">
                                        <%#DataBinder.Eval(Container.DataItem,"CreatedTime") %>
                                    </span>
                                </td>
                                <td align="Right">
                                    <asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"StateCount") %>'></asp:Label>
                                    <a href="#" onclick="AddState(this,<%#DataBinder.Eval(Container.DataItem,"CommentID") %>)" >有用</a>                                    
                                    <asp:Label ID="Label2" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"FuCommentCount") %>'></asp:Label>
                                    <asp:HyperLink ID="HyperLink1" runat="server" Target="_blank" NavigateUrl='<%#Eval("CommentID","ShowAllCommentAddFuC.aspx?CommentID={0}") %>'>回应</asp:HyperLink>
                                    <asp:LinkButton ID="LinkButton2" runat="server" Visible="false" OnClientClick='<%#Eval("CommentID","AddFuComment({0})") %>'>回应</asp:LinkButton>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <span id='pl<%#DataBinder.Eval(Container.DataItem, "NewPlayTime")%>' class="commentcontent">
                                        <%#DataBinder.Eval(Container.DataItem,"Content") %>
                                    </span>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            </table>
                        </FooterTemplate>
                    </asp:Repeater>
                </td>
            </tr>
        </table>
       </asp:Panel>
       <script type="text/javascript">
           //有用
            function AddState(e,name)
            {
                var flag=true;
			    var rand=Math.random();    
                var filter=name;
			    $.ajax({
					    type: "get",
					    dataType: "text",
					    url: "ajaxAddComment.aspx",
					    data: "commentid="+escape(filter),
					    async: false,
					    success: function(msg){
    					//alert(msg);					    
						    }
				    });
			    return flag;
            }
            
            function AddComment()
            {
                var vObj=findFrame(window.parent.MainFrame);
                vObj.MediaPlayer.Controls.Pause();
                //var cu = window.ffMain.LeftupFrame.MediaPlayer.Controls.currentPosition;
                var cu =  vObj.MediaPlayer.Controls.currentPosition;
                var ul = "AddComment.aspx?ResourceID=<%=_ResourceID %>&UserID=<%=_UserID %>&playtime="+cu;
                window.showModalDialog(ul,window,"dialogWidth: 530px; dialogHeight: 300px;status: no; help: no");
            }
             function ShowComment()
            {
                var v =getCookie2("showcomment");
                if(v == "1")
                {
                    //var cu = "pl" + window.ffMain.LeftupFrame.MediaPlayer.Controls.currentPosition;                               
                    var vObj=findFrame(window.parent.MainFrame);                    
                    cu = "pl" + vObj.MediaPlayer.Controls.currentPosition;
                    var ss =cu.substring(0,cu.indexOf("."));
                    var s = document.getElementById(ss);
                    if(s!= null)
                    {
                        //window.ffMain.LeftupFrame.MediaPlayer.Controls.Pause();
                        var vObj=findFrame(window.parent.MainFrame);
                        vObj.MediaPlayer.Controls.Pause();                        
                        var ul = "showcomment.htm?title="+s.innerHTML+"&content="+s.innerHTML;
                        window.showModalDialog(ul,window,"dialogWidth: 600px; dialogHeight: 300px;status: no; help: no");
                    }
                }
            }
            function SetShowComment()
            {
                setCookie("showcomment","1");
            }
            function SetNoShowComment()
            {
                setCookie("showcomment","0");
            }
            setInterval("ShowComment();",1000);
        </script>
    </form>
</body>
</html>
